package com.hanyxx.digui;

/**
 * @author layman
 */
public class Demo02Recurison {

    public static void main(String[] args) {
        int s = sum(3);
        System.out.println(s);
    }

    public static int sum(int n){
        // 结束条件
        if(n == 1){
            return 1;
        }
        return n + sum(n-1);
    }

}
